#include "vtkFunctions_import.hpp"

namespace hms
{

template<typename SolverType>
void readFields(
	Settings& s,
	SolverBase<SolverType>& solver,
	const xml::XMLDocument* domainDoc,
	const xml::XMLDocument* boundaryDoc
){
	using namespace vtk;
	xml::XMLDocument constDoc, sourceDoc;
	/* read fields */
	s.logger().debug("Reading fields");
	solver.logger().debug(
		"Reading domain and boundary fields of state variables..."
	);
	readDomainFields      (  domainDoc, solver, false);
	readBoundaryConditions(boundaryDoc, solver, false);

	/* read constant fields */
	solver.logger().debug("Reading constant fields...");
	getConstantFieldsDoc(&constDoc, s.caseDir(), s.dummyFileCreated, s.dryRun);
	readConstantFields( &constDoc, solver );
	
	/* read source fields */
	solver.logger().debug("Reading source fields...");
	getSourceFieldsDoc(&sourceDoc, s.caseDir(), s.dummyFileCreated, s.dryRun);
	readSourceFields( &sourceDoc, solver );
}

} // namespace hms
